package com.muchfish.function;

import java.util.Arrays;
import java.util.List;
import java.util.function.Function;

public class MyStream {
    public static void main(String[] args) {
        List<String> myList = Arrays.asList("5555", "1", "333", "22", "4444");

        myList.stream()
                .filter(s -> {
                    System.out.println("filter s = " + s); //【回调函数】
                    if (s.length() < 3) {
                        System.out.println("filter 收集到数据了!!!!!!!!");
                    } else {
                        System.out.println("filter 未收集到数据");
                    }
                    return s.length() < 3;
                })
                .map((Function<String, Object>) s -> {
                    System.out.println("map s = " + s); //【回调函数】
                    return s.toUpperCase();
                })
                .forEach(s -> {
                    System.out.println("forEach s = " + s); //【回调函数】
                });
    }
}
